import java.util.Arrays;

class Solution {
	public int maxIceCream(int[] costs, int coins) {
		Arrays.sort(costs);// 升序
		int i = 0,n = costs.length;
		while( i<n && coins > costs[i]){
			coins -= costs[i];
			i++;
		}
		return i;
	}
}